var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2EventCenter = require("EventCenter");
var $2EventDefine = require("EventDefine");
var $2TimeManager = require("TimeManager");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_tilitime = /* */function (_cc$Component41) {
  function _ctor() {
    var _this189;
    babel_classCallCheck(this, _ctor);
    _this189 = _callSuper(this, _ctor, arguments);
    _this189.label = null;
    _this189.tagettime = 0;
    _this189.time = 0;
    _this189.key = false;
    _this189.tiliTime = 0;
    return _this189;
  }
  babel_inherits(_ctor, _cc$Component41);
  return babel_createClass(_ctor, [{
    key: "onLoad",
    value: function onLoad() {
      $2EventCenter.default.regisEvent($2EventDefine.default.EVENT_TILITIME, this.resettime, this);
      $2EventCenter.default.regisEvent($2EventDefine.default.EVENT_UPDATE, this.mainUpdate, this);
    }
  }, {
    key: "resettime",
    value: function resettime(e) {
      this.tagettime = e;
      this.time = 1;
    }
  }, {
    key: "mainUpdate",
    value: function mainUpdate(e) {
      if (0 != this.tagettime) {
        this.time += e;
        if (this.time > 1) {
          this.time -= 1;
          var _e105 = "";
          var _t97 = this.tagettime - $2TimeManager.TimeManager.getInstance().getCurrentTime();
          if (_t97 <= 0) {
            ;
          } else {
            var _n97 = _t97 / 6e4 | 0;
            var _o170 = (_t97 - 6e4 * _n97) / 1e3 | 0;
            _e105 = (_n97 < 10 ? "0" : "") + _n97.toString() + ":";
            _e105 += (_o170 < 10 ? "0" : "") + _o170.toString();
          }
          this.label.string = _e105;
        }
      } else {
        this.label.string = "";
      }
    }
  }, {
    key: "onEnable",
    value: function onEnable() {
      this.time = 1;
    }
  }]);
}(cc.Component);
cc__decorate([ccp_property(cc.Label)], def_tilitime.prototype, "label", undefined);
def_tilitime = cc__decorate([ccp_ccclass], def_tilitime);
exports.default = def_tilitime;